package com.gao;

import com.gao.prototype.PrototypeBean;
import com.gao.setter.BarBean;
import com.gao.setter.FooBean;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author GaoXi
 * @date 2022/2/22 21:43
 */
public class Starter {
    /**
     * setter方法可以解决循环依赖，这里还有个暗坑，toString不能互调的
     * @param args
     */
    public static void main(String[] args) {
        ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("spring.xml");
        BarBean bean = applicationContext.getBean(BarBean.class);
        System.out.println(bean);
        FooBean bean1 = applicationContext.getBean(FooBean.class);
        System.out.println(bean1);

        PrototypeBean bean2 = applicationContext.getBean(PrototypeBean.class);
        System.out.println(bean2);

    }
}
